package com.cupster.func_db_dbflow5.db_main.crud;

import com.cupster.func_db_dbflow5.DBManager;
import com.cupster.func_db_dbflow5.db_main.table.User;
import com.dbflow5.query.SQLite;

public class UserHelper {

    public static long insert(User user){
        return user.insert(DBManager.getAppDB());
    }

    public static User queryById(long id){
       return SQLite.select().from(User.class).where(User_Table.id.eq(id)).querySingle(DBManager.getAppDB());
    }

    public static String queryByName(String name){
       User u =  SQLite.select().from(User.class).where(User_Table.name.eq(name)).querySingle(DBManager.getAppDB());
       return  u.getAccount();
    }


}
